package DemoBall;

import java.awt.Component;

public class BallRunnable implements Runnable {
	private Ball ball;
	private Component component; 
	private int DELAY = 5;
	public BallRunnable(Ball ball, Component component, int delay){
		this.ball = ball;
		this.component = component;
		this.DELAY = delay;
	}
	
	public BallRunnable(int delay){
		this.DELAY = delay;
	}
	
	public void run(){
		try{
			for(int i = 1; i<= i++; i++){
				ball.move(component.getBounds());
				component.repaint();
				Thread.sleep(DELAY);
			}
		}
		catch(InterruptedException e){}
		}
}
